package com.my.house;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 收费类型枚举
 * @author yangll
 */
@AllArgsConstructor
@Getter
public enum FeeTypeEnum {
    /**
     * 房租，水费，电费
     */
    RENT("rent","房租"),
    WATER("water","水费"),
    ELECTRIC("electric","电费"),
    ;
    /**
     * 收费类型
     */
    @JsonValue
    @EnumValue
    private final String feeType;
    /**
     * 描述
     */
    private final String desc;

    @JsonCreator
    public static FeeTypeEnum getFeeTypeEnum(String feeType) {
        for (FeeTypeEnum feeTypeEnum : FeeTypeEnum.values()) {
            if (feeTypeEnum.getFeeType().equals(feeType)) {
                return feeTypeEnum;
            }
        }
        return null;
    }
}
